import Cookies from 'js-cookie'

const TokenKey = 'Admin-Token'

export function getToken() {
  // return sessionStorage.getItem(TokenKey)
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  // return sessionStorage.setItem(TokenKey, token)
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  // return sessionStorage.removeItem(TokenKey)
  return Cookies.remove(TokenKey)
}

export function getMenu() {
  return JSON.parse(sessionStorage.getItem('MenuTree'))
}

export function setMenu(menu) {
  return sessionStorage.setItem('MenuTree', JSON.stringify(menu))
}

export function getTagsView() {
  return JSON.parse(sessionStorage.getItem('TagsView') || '[]')
}

export function setTagsView(tags) {
  return sessionStorage.setItem('TagsView', JSON.stringify(tags))
}

